package com.seckill.controller;

import com.seckill.service.IUserService;
import com.seckill.vo.LoginVO;
import com.seckill.vo.RespBean;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/login")
@Slf4j
public class LoginController {
    @Resource
    private IUserService userService;
    @RequestMapping("/toLogin")
    public String doLogin() {
        return "login";
    }
    @RequestMapping("/doLogin")
    @ResponseBody
    public RespBean doLogin(@Valid LoginVO loginVO) {
        log.info("登录参数：{}", loginVO);
        return userService.doLogin(loginVO);
    }
}
